package com.woniuxy.entity.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author: linKe
 * @Date: 2021/12/3 9:10
 * @FileName: PageFilter
 * @version: 1.0
 * @Description: 分页数据
 */
@ApiModel(value = "分页数据")
@Data
public class PageFilter implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "页码", example="1")
    private int pageNo = 1;

    @ApiModelProperty(value = "页面大小", example="10")
    private int pageSize = 10;

    @ApiModelProperty(value = "排序字段", example="id")
    private String orderColumn = "id";

    @ApiModelProperty(value = "排序类型", allowableValues="asc,desc", example="asc")
    private String orderType = "asc";

    public PageFilter() {}

    /**
     * 构造函数
     * @param pageNo
     * @param pageSize
     */
    public PageFilter(int pageNo, int pageSize) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }

    /**
     * 构造函数
     * @param pageNo
     * @param pageSize
     * @param orderColumn	待排序的表列名
     * @param orderType		asc|desc
     */
    public PageFilter(int pageNo, int pageSize, String orderColumn, String orderType) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.orderColumn = orderColumn;
        this.orderType = orderType;
    }

}
